import requests
import json

# 非流式输出！！！ 一次性   参数设置随机性最小!!!
#
#
#


url = "https://api.siliconflow.cn/v1/chat/completions"

payload = {
    "model": "internlm/internlm2_5-7b-chat",
    "stream": False,  # 启用流式输出
    "max_tokens": 512,
    "temperature": 0.01,
    "top_p": 0.01,
    "top_k": 1,
    "frequency_penalty": 0,
    "n": 1,
    "stop": [],
    "messages": [
        {
            "content": "你好，你是谁？",
            "role": "user"
        }
    ]
}
headers = {
    "Authorization": "Bearer sk-pusgnznrckhdogxrchddbfzrypvljzjdydjogvnfbprehtkj",
    "Content-Type": "application/json"
}


response = requests.post(url, json=payload, headers=headers)
json_test = json.loads(response.text)
text = json_test['choices'][0]['message']['content']

print(text)
